package com.ym.controller.patient.self;

import com.ym.common.constant.Constants;
import com.ym.core.annotation.ApiSign;
import com.ym.core.annotation.Log;
import com.ym.core.domain.APIResponse;
import com.ym.core.domain.BaseController;
import com.ym.core.shiro.ShiroUtil;
import com.ym.medical.domain.param.ExamDoctorParam;
import com.ym.medical.domain.vo.ClinicDoctorVO;
import com.ym.medical.domain.vo.ResultDocDetailVo;
import com.ym.medical.enums.RuleTypeEnum;
import com.ym.medical.service.IResultDoctorSV;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 名医义诊
 *
 * @Author: DaiKuangYin
 * @Date: 2019/10/29 15:28
 */
@Api(tags = "患者端-名医义诊")
@RestController
@ApiSign()
@RequestMapping(value = "/patient/self/freeClinic", headers = Constants.Api.VERSION)
public class FreeClinicController extends BaseController {

	private static Logger logger = LoggerFactory.getLogger(FreeClinicController.class);

	@Autowired
	private IResultDoctorSV resultDoctorSV;


	@ApiOperation("义诊医生列表")
	@GetMapping(value = "/doctor/list")
	public APIResponse<ClinicDoctorVO> listFreeClinicDoctor(@RequestParam(defaultValue = "1", required = false) int pageNum,
															@RequestParam(defaultValue = "10", required = false) int pageSize,
															ExamDoctorParam examDoctor) {
		examDoctor.setCurrentId(ShiroUtil.getLoginId());
		examDoctor.setQuerySource(RuleTypeEnum.YIZHEN_RULES.getKey());
		return successData(resultDoctorSV.listFreeClinicDoctor(pageNum, pageSize, examDoctor));
	}

	@Log
	@ApiOperation("患者端-义诊医生个人信息")
	@GetMapping(value = "/doctorId")
	public APIResponse<ResultDocDetailVo> selectByDoctorId(ExamDoctorParam examDoctor) {
		ResultDocDetailVo resultDocDetail = resultDoctorSV.findDoctorById(examDoctor, ShiroUtil.getLoginId());
		return successData(resultDocDetail);
	}


}
